<?php 

$oid = $_GET['listing_id'];
$mquery = "select p.* from PROPERTIES p where p.OID = '".$oid."'";
$mresult = mysql_query($mquery) or die ("SQL Error".mysql_error());
$prow = mysql_fetch_assoc($mresult);
if($prow['UNITFLOORNUM'] !='')
{
	$unit = " ".$prow['UNITFLOORNUM'];
}
else
{
	$unit = '';
}
$full_address = $prow['STREETNUM']." ".$prow['STREETDIR']." ".$prow['STREETNAME']." ".$prow['STREETSUFFIX']."".$unit.", ".$prow['CITY']." ".$prow['STATE']." ".$prow['ZIPCODE'];

$query = "Select * from VT_Config where Listing_ID = '".$oid."'";
$result = mysql_query($query) or die ("SQL Error".mysql_error());
$rowv = mysql_fetch_assoc($result);
?>

<table bgcolor="#666666" style=" color:#999999; border-top:1px solid black; border-bottom:1px solid black; font-family:Arial, Helvetica, sans-serif" align="center" width="100%" border="0" cellspacing="0" cellpadding="0">
			<TR>
				<TD align="center" style="padding:2px 0px 2px 20px; height:20px;">
					<table width="825" border="0" cellspacing="1" cellpadding="1">
						  <tr>
							<td align="left" style="color:#FFFFFF; font-size:18px;">
							<?php echo $full_address ?> | 
							Asking Price: $<?php echo number_format($prow['LISTPRICE'], 0) ?>
							</td>
						  </tr>
						</table>
				</TD>
			</TR>
		</Table>


<?php

$listing_id = $_GET['listing_id'];

$sql = "Select * from PROPERTIES where OID = '".$listing_id."'";
$result = mysql_query($sql) or die ("SQL Error".mysql_error());
$row=mysql_fetch_assoc($result);


$latitude = $row["LATITUDE"];
$longitude = $row["LONGITUDE"];
$zipcode = $row["ZIPCODE"];
$city = $row["CITY"];
$state = 'CA';

?>

<table width="800">

<tr>
<td colspan="2" style="color:#CC6600; font-size: 24px; font-family:"Times New Roman", Times, serif" align="center"> Neighborhood Demographics For <?php  echo $row["CITY"]. ",". $row["STATE"]." ".$row["ZIPCODE"]?>
</td>
</tr>
</table>
<Table  style="border-style:solid; border-width:thin;">
<tr>
<td colspan="2" align="center" style="background-color:#96BA61; font-size:14px; color:#FFFFFF">
<b> Population By Sex</b>
</td>
</tr>
<tr>
<td valign="middle">
<?php include ABS_PATH.'inc.popBysex.php'?>
</td>
<?php 
if($total_pop != 0)
{
?>
<td>
	  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="350" 
			HEIGHT="250" 
			id="charts" 
			ALIGN="">
		<PARAM NAME=movie VALUE="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newpopbysex_xml.php?zipcode=<?php echo $zipcode?>&random=<?php echo rand() ?>" >
		<PARAM NAME=quality VALUE=high>
		<PARAM NAME=bgcolor VALUE=#ffffff>
		
		<EMBED src="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newpopbysex_xml.php?zipcode=<?php echo $zipcode ?>&random=<?php echo rand() ?>"
			   quality=high 
			   bgcolor=#ffffff  
			   WIDTH="350" 
			   HEIGHT="250" 
			   NAME="charts" 
			   ALIGN="" 
			   swLiveConnect="true" 
			   TYPE="application/x-shockwave-flash" 
			   PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
		</EMBED>
		</OBJECT>

</td>
<?
}
?>
</tr>
</Table>
<Table style="border-style:solid; border-width:thin;">
<tr>
<td colspan="2" align="center" style="background-color:#96BA61; font-size:14px; color:#FFFFFF">
<b> Population by Race</b>
</td>
</tr>
<tr>
<td valign="middle">
<?php include ABS_PATH.'inc.popByrace.php'?>
</td>
<?php 
if($total_pop != 0)
{
?>
<td align="left">
	  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="350" 
			HEIGHT="250" 
			id="charts" 
			ALIGN="">
		<PARAM NAME=movie VALUE="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newpopbyrace_xml.php?zipcode=<?php echo $zipcode?>&random=<?php echo rand() ?>" >
		<PARAM NAME=quality VALUE=high>
		<PARAM NAME=bgcolor VALUE=#ffffff>
		
		<EMBED src="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newpopbyrace_xml.php?zipcode=<?php echo $zipcode ?>&random=<?php echo rand() ?>"
			   quality=high 
			   bgcolor=#ffffff  
			   WIDTH="350" 
			   HEIGHT="250" 
			   NAME="charts" 
			   ALIGN="" 
			   swLiveConnect="true" 
			   TYPE="application/x-shockwave-flash" 
			   PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
		</EMBED>
		</OBJECT>
</td>
<?
}
?>

</tr>
</Table>

<Table style="border-style:solid; border-width:thin;">
<tr>
<td colspan="2" align="center" style="background-color:#96BA61; font-size:14px; color:#FFFFFF">
<b> Population By Age(Years)</b>
</td>
</tr>
<tr>
<td valign="middle">
<?php include ABS_PATH.'inc.popByage.php'?>
</td>
<?php 
if($total_pop != 0)
{
?>
<td align="left">
	  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="360" 
			HEIGHT="250" 
			id="charts" 
			ALIGN="">
		<PARAM NAME=movie VALUE="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newpopbyage_xml.php?zipcode=<?php echo $zipcode?>&random=<?php echo rand() ?>" >
		<PARAM NAME=quality VALUE=high>
		<PARAM NAME=bgcolor VALUE=#ffffff>
		
		<EMBED src="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newpopbyage_xml.php?zipcode=<?php echo $zipcode ?>&random=<?php echo rand() ?>"
			   quality=high 
			   bgcolor=#ffffff  
			   WIDTH="360" 
			   HEIGHT="250" 
			   NAME="charts" 
			   ALIGN="" 
			   swLiveConnect="true" 
			   TYPE="application/x-shockwave-flash" 
			   PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
		</EMBED>
		</OBJECT>
</td>
<?
}
?>
</tr>
</table>
<Table style="border-style:solid; border-width:thin;">
<tr>
<td colspan="2" align="center" style="background-color:#96BA61; font-size:14px; color:#FFFFFF">
<b> Employment Status</b>
</td>
</tr>
<tr>
<td valign="middle">
<?php include ABS_PATH.'inc.emp_status.php'?>
</td>
<?php 
if($total_pop != 0)
{
?>
<td align="left">
	  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="360" 
			HEIGHT="255" 
			id="charts" 
			ALIGN="">
		<PARAM NAME=movie VALUE="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newemplstatus_xml.php?zipcode=<?php echo $zipcode?>&random=<?php echo rand() ?>" >
		<PARAM NAME=quality VALUE=high>
		<PARAM NAME=bgcolor VALUE=#ffffff>
		
		<EMBED src="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newemplstatus_xml.php?zipcode=<?php echo $zipcode ?>&random=<?php echo rand() ?>"
			   quality=high 
			   bgcolor=#ffffff  
			   WIDTH="360" 
			   HEIGHT="255" 
			   NAME="charts" 
			   ALIGN="" 
			   swLiveConnect="true" 
			   TYPE="application/x-shockwave-flash" 
			   PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
		</EMBED>
		</OBJECT>
</td>
<?
}
?>
</tr>
</Table>
<Table style="border-style:solid; border-width:thin;">
<tr>
<td colspan="2" align="center" style="background-color:#96BA61; font-size:14px; color:#FFFFFF">
<b> Household Income Distribution</b>
</td>
</tr>
<tr>
<td valign="middle">
<?php include ABS_PATH.'inc.householdincom.php'?>
</td>
<?php 
if($total_household != 0)
{
?>
<td align="left">
	  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="350" 
			HEIGHT="250" 
			id="charts" 
			ALIGN="">
		<PARAM NAME=movie VALUE="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/householdincome_xml.php?zipcode=<?php echo $zipcode?>&random=<?php echo rand() ?>" >
		<PARAM NAME=quality VALUE=high>
		<PARAM NAME=bgcolor VALUE=#ffffff>
		
		<EMBED src="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/householdincome_xml.php?zipcode=<?php echo $zipcode ?>&random=<?php echo rand() ?>"
			   quality=high 
			   bgcolor=#ffffff  
			   WIDTH="350" 
			   HEIGHT="250" 
			   NAME="charts" 
			   ALIGN="" 
			   swLiveConnect="true" 
			   TYPE="application/x-shockwave-flash" 
			   PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
		</EMBED>
		</OBJECT>
</td>
<?
}
?>
</tr>
</Table>
<Table style="border-style:solid; border-width:thin;">
<tr>
<td colspan="2" align="center" style="background-color:#96BA61; font-size:14px; color:#FFFFFF">
<b> Home Occupancy Type</b>
</td>
</tr>
<tr>
<td valign="middle">
<?php include ABS_PATH.'inc.ownedORrented.php'?>
</td>
<?php 
if($total_houses != 0 && $ocupied_houses != 0)
{
?>
<td align="left">
	  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="350" 
			HEIGHT="250" 
			id="charts" 
			ALIGN="">
		<PARAM NAME=movie VALUE="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newownedrented_xml.php?zipcode=<?php echo $zipcode?>&random=<?php echo rand() ?>" >
		<PARAM NAME=quality VALUE=high>
		<PARAM NAME=bgcolor VALUE=#ffffff>
		
		<EMBED src="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/newownedrented_xml.php?zipcode=<?php echo $zipcode ?>&random=<?php echo rand() ?>"
			   quality=high 
			   bgcolor=#ffffff  
			   WIDTH="350" 
			   HEIGHT="250" 
			   NAME="charts" 
			   ALIGN="" 
			   swLiveConnect="true" 
			   TYPE="application/x-shockwave-flash" 
			   PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
		</EMBED>
		</OBJECT>
</td>
<?
}
?>
</tr>
</Table>
<Table style="border-style:solid; border-width:thin;">
<tr>
<td colspan="2" align="center" style="background-color:#96BA61; font-size:14px; color:#FFFFFF">
<b> Crime Index Rate</b>
</td>
</tr>
<tr>
<td valign="middle">
<?php include ABS_PATH.'inc.crimeindexrate.php'?>
</td>
<td align="left">
	  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
			WIDTH="360" 
			HEIGHT="250" 
			id="charts" 
			ALIGN="">
		<PARAM NAME=movie VALUE="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/crimerates.php?city=<?php echo $city?>&random=<?php echo rand() ?>" >
		<PARAM NAME=quality VALUE=high>
		<PARAM NAME=bgcolor VALUE=#ffffff>
		
		<EMBED src="../charts.swf?license=K1XNKW6QK-7L.NS5T4Q79KLYCK07EK&library_path=../charts_library&xml_source=../accounts/chart_xml/crimerates.php?city=<?php echo $city ?>&random=<?php echo rand() ?>"
			   quality=high 
			   bgcolor=#ffffff  
			   WIDTH="360" 
			   HEIGHT="250" 
			   NAME="charts" 
			   ALIGN="" 
			   swLiveConnect="true" 
			   TYPE="application/x-shockwave-flash" 
			   PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
		</EMBED>
		</OBJECT>
</td>
</tr>
</table>
